home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / IAC Tools / iacdate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.5 KB  |  78 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1993 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4. #include "iacinternal.h"
  5.  
  6.  
  7. #define typeDate 'date'
  8.  
  9.  
  10.  
  11.  
  12. Boolean IACpushdateparam (long val, OSType keyword) {
  13.  
  14.     return (IACpushdateitem (IACglobals.event, val, keyword));
  15.     } /*IACpushdateparam*/
  16.  
  17.  
  18. Boolean IACreturndate (long x) {
  19.     
  20.     return (IACpushdateitem (IACglobals.reply, x, keyDirectObject));
  21.     } /*IACreturndate*/
  22.  
  23.  
  24. Boolean IACgetdateparam (OSType keyword, long *val) {
  25.     
  26.     if (!IACgetdateitem (IACglobals.event, keyword, val)) {
  27.         
  28.         IACparamerror (IACglobals.errorcode, "\pdate", keyword);
  29.         
  30.         return (false);
  31.         }
  32.     
  33.     IACglobals.nextparamoptional = false; /*must be reset for each param*/
  34.     
  35.     return (true);
  36.     } /*IACgetdateparam*/
  37.     
  38.  
  39. Boolean IACgetdateitem (AEDescList *list, long n, long *val) {
  40.     
  41.     register OSErr ec;
  42.     DescType key;
  43.     DescType typeCode;
  44.     Size actualSize;
  45.     
  46.     if ((*list).descriptorType != typeAEList) {
  47.         
  48.         ec = AEGetKeyPtr (list, n, typeDate, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  49.             
  50.         if (ec != errAEDescNotFound)
  51.             goto done;
  52.         }
  53.  
  54.     ec = AEGetNthPtr (list, n, typeDate, &key, &typeCode, (Ptr) val, sizeof (*val), &actualSize);
  55.     
  56.     done:
  57.     
  58.     IACglobals.errorcode = ec;
  59.     
  60.     return (ec == noErr);
  61.     } /*IACgetdateitem*/
  62.  
  63.  
  64. Boolean IACpushdateitem (AEDescList *list, long val, long n) {
  65.     
  66.     register OSErr ec;
  67.     
  68.     if ((*list).descriptorType != typeAEList)
  69.         ec = AEPutKeyPtr (list, n, typeDate, (Ptr) &val, sizeof (val));
  70.     else
  71.         ec = AEPutPtr (list, n, typeDate, (Ptr)&val, sizeof (val));
  72.     
  73.     IACglobals.errorcode = ec;
  74.     
  75.     return (ec == noErr);
  76.     } /*IACpushdateitem*/
  77.  
  78.